using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using ZedGraph;
using ZedGraph.Web;
using System.Drawing;
using System.Collections.Generic;

public partial class Overzicht_Lector : System.Web.UI.Page
{

    private String Gebruiker;
    private Databank db;
    private bool on;
    private DateTime start;
    private DateTime end;
    SessionGebruiker sg;

    protected void Page_Load(object sender, EventArgs e)
    {
        db = Databank.DatabankInstantie;

        Getuserstuff();
        if (!Page.IsPostBack)
        {
            InlezenVakken();
            VakListbox.Items[0].Selected = true;
            on = false;
            StartCalendar.SelectedDate = DateTime.Now;
            EndCalendar2.SelectedDate = DateTime.Now;
        }
    }


    private void Getuserstuff()
    {

        sg = (SessionGebruiker)Session["login"];
        if (sg != null)
        {
            Gebruiker = sg.Gebruiker;
        }
    }


    private void InlezenVakken()
    {
        VakListbox.Items.Clear();

        List<Vak> vakken = new List<Vak>();
        vakken = db.GetDocentVakken(Gebruiker);

        foreach (Vak v in vakken)
        {
            VakListbox.Items.Add(new ListItem(v.Naam, v.Id.ToString()));
        }



    }
    protected void UpdateButton_Click(object sender, EventArgs e)
    {
        ZedGraphWeb2.Visible = true;
        start = StartCalendar.SelectedDate;
        end = EndCalendar2.SelectedDate;
    }
    protected void ZedGraphWeb2_RenderGraph(ZedGraphWeb webObject, Graphics g, MasterPane pane)
    {
        Grafieken gr = new Grafieken(Gebruiker);
         gr.OverzichtKlassen(webObject, g, pane, "Overzicht vak " + VakListbox.SelectedItem.Text, VakListbox.SelectedItem.Value, "leerlingen", "studie tijd in uur", OnCheckBox.Checked, start, end);

    }
    protected void OnCheckBox_CheckedChanged(object sender, EventArgs e)
    {
        on = OnCheckBox.Checked;
    }
}
